package com.liwbn.rbac.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.liwbn.rbac.core.orm.mybatis.Page;
import com.liwbn.rbac.model.Role;
import com.liwbn.rbac.model.RoleExample;
import com.liwbn.rbac.vo.RolePermissionVO;

public interface RoleMapper {
    int countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Long id);

    long insert(Role record);

    int insertSelective(Role record);

    /**
     * 分页条件查询
     * 
     * @param page
     * @param example
     * @return
     */
    List<Role> selectByExample(Page<Role> page, RoleExample example);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") Role record,
            @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record,
            @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    /**
     * 获取素有的角色权限信息
     * 
     * @param example
     * @return
     */
    public List<RolePermissionVO> selectAllRolesAndPermission(
            RoleExample example);

    public List<Role> selectRolesByUserName(String userName);
}
